﻿package {
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.utils.getTimer;
	import flash.system.Capabilities;
	
	import tea.game.LF3.gameLoop;
	import tea.game.LF3.Render;
	import tea.game.LF3.DataProcesser;
	import tea.game.dataContainer;
	import tea.game.bmpCache;
	import tea.lib.SystemTest;
	//deconder
	
	public class FLF extends MovieClip {
		//private var 畛
		public var systemData:Array;
		public var mainStage:MovieClip = new MovieClip();
		
		public function log(...arg):void {
			try {
				trace(arg);
				tracer.visible = true;
				tracer.appendText(arg.toString() + "\n");
			}catch(e:Error){}
		}
		
		public function FLF() {
			//init system
			stage.align = "tl";
			stage.scaleMode = "noScale";
			tracer.visible = false;
			getSystemInfo();
			addChildAt(mainStage, 0);
			//load data
			var loadList:Array = [];
			loadList.push("data/dataList.xml");
			loadList.push("data/bmpList.xml");
			dataContainer.getInstance().loadAll(loadList);
			dataContainer.getInstance().addEventListener("allDone", Init2);
			//Make UI
			
			//tempInit();
			
			//start game*/
			
		}
		
		private function getSystemInfo():void {
			log(Capabilities.screenResolutionX, Capabilities.screenResolutionY)
			log(Capabilities.pixelAspectRatio, Capabilities.screenDPI);
			log(stage.stageWidth, stage.stageHeight);
			
			log(SystemTest.traceData);
			/*

			
			
			1)NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
			2)auto rotation class
			3)set stage,get res/dpi
			
			http://help.adobe.com/zh_TW/FlashPlatform/reference/actionscript/3/flash/events/TransformGestureEvent.html
			http://www.otierney.net/objective-c.html.zh-tw.big5#downloading
			*/
		}
		private function Init2(e:Event):void {
			dataContainer.getInstance().removeEventListener("allDone", Init2);
			DataProcesser.getInstance().dataList = new XML(dataContainer.getInstance().getData("data/dataList.xml"));//decode
			DataProcesser.getInstance().bmpList = new XML(dataContainer.getInstance().getData("data/bmpList.xml"));
			
		}
		private function StartGame() :void {
			
		}
	}

}